package pl.pawluk.inz.entities;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;

/**
 * Created with IntelliJ IDEA.
 * User: mandp
 * Date: 17.05.13
 * Time: 19:39
 * To change this template use File | Settings | File Templates.
 */
@javax.persistence.Table(name = "group_authorities", schema = "public", catalog = "")
@Entity
public class GroupAuthoritiesEntity {
    private Long groupId;

    @javax.persistence.Column(name = "group_id", nullable = false, insertable = true, updatable = true, length = 19, precision = 0)
    @Id
    public Long getGroupId() {
        return groupId;
    }

    public void setGroupId(Long groupId) {
        this.groupId = groupId;
    }

    private String authority;

    @javax.persistence.Column(name = "authority", nullable = false, insertable = true, updatable = true, length = 50, precision = 0)
    @Basic
    public String getAuthority() {
        return authority;
    }

    public void setAuthority(String authority) {
        this.authority = authority;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        GroupAuthoritiesEntity that = (GroupAuthoritiesEntity) o;

        if (authority != null ? !authority.equals(that.authority) : that.authority != null) return false;
        if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = groupId != null ? groupId.hashCode() : 0;
        result = 31 * result + (authority != null ? authority.hashCode() : 0);
        return result;
    }
}
